/*
 ------------------------------------------------------------------------------
 Copyright (C) 2013 Eternal Games.

 This file is part of the GLQuake source code.

 The GLQuake source code is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.

 The GLQuake source code is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 more details.

 You should have received a copy of the GNU General Public License along with
 the GLQuake source code; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 ------------------------------------------------------------------------------
*/


//
// game.h - common definitions between client and server game modules
//


#ifndef __GAME_H__
#define __GAME_H__


#include "../shared/shared.h"


#define GAME_NAME						"GLQuake Game"
#define GAME_VERSION					"GLQuake Game 0.1.0 BETA"

#define ENTITYNUM_NONE					(MAX_ENTITIES - 1)
#define ENTITYNUM_WORLD					(MAX_ENTITIES - 2)
#define ENTITYNUM_MAX_NORMAL			(MAX_ENTITIES - 2)

#define DEFAULT_GRAVITY					800.0f

// Per-level limits
#define MAX_GAME_MODELS					512
#define MAX_GAME_MATERIALS				512
#define MAX_GAME_SOUND_SHADERS			512

enum soundChannel_t {
	SND_CHANNEL_ANY			= SOUND_CHANNEL_ANY,
	SND_CHANNEL_BODY,
	SND_CHANNEL_VOICE,
	SND_CHANNEL_WEAPON,
	SND_CHANNEL_ITEM,
	SND_CHANNEL_AMBIENT,
	SND_CHANNEL_MISC
};

enum meansOfDeath_t {
	MOD_UNKNOWN,
	MOD_SUICIDE
};

struct game_t {
	bool					isClient;

	memoryTag_t				memoryTag;

	glqRandom				random;
};

extern game_t				game;

extern cvar_t *				com_dedicated;
extern cvar_t *				com_developer;

extern cvar_t *				pm_msec;
extern cvar_t *				pm_jumpHeight;
extern cvar_t *				pm_walkSpeed;
extern cvar_t *				pm_runSpeed;
extern cvar_t *				pm_noclipSpeed;
extern cvar_t *				pm_spectateSpeed;
extern cvar_t *				pm_boxWidth;
extern cvar_t *				pm_spectateBoxSize;
extern cvar_t *				pm_normalHeight;
extern cvar_t *				pm_normalViewHeight;
extern cvar_t *				pm_deadHeight;
extern cvar_t *				pm_deadViewHeight;
extern cvar_t *				pm_minNormalPitch;
extern cvar_t *				pm_maxNormalPitch;

// GLQuake engine framework
extern glqCommon_t *		glqCommon;
extern glqMemory_t *		glqMemory;
extern glqFileSystem_t *	glqFileSystem;
extern glqCmdSystem_t *		glqCmdSystem;
extern glqCVarSystem_t *	glqCVarSystem;
extern glqMsgSystem_t *		glqMsgSystem;
extern glqDefManager_t *	glqDefManager;
extern glqParser_t *		glqParser;
extern glqSystem_t *		glqSystem;
extern glqTable_t *			glqTable;
extern glqCollision_t *		glqCollision;
extern glqRenderer_t *		glqRenderer;
extern glqSound_t *			glqSound;
extern glqGUI_t *			glqGUI;

/*
 ==============================================================================

 GAME HEADERS

 ==============================================================================
*/

#include "dict.h"
#include "entFile.h"
#include "trajectory.h"
#include "protocol.h"

#include "ai/ai_public.h"

#include "anim/anim_public.h"

#include "physics/physics_player.h"
#include "physics/physics_monster.h"
#include "physics/physics_rigidBody.h"

/*
 ==============================================================================

 GAME FUNCTIONS

 ==============================================================================
*/

void			G_Printf (const char *fmt, ...);
void			G_DPrintf (const char *fmt, ...);
void			G_Error (const char *fmt, ...);

int				G_EncodeBounds (const glqBounds &bounds);

void			G_PlayerStateToEntityState (playerState_t *ps, entityState_t *es);

void			G_Init (bool isClient);
void			G_Shutdown (bool isClient);


#endif	// __GAME_H__